﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using AirForceCDCTests.src.main;

namespace AirForceCDCTests
{
    /// <summary>
    /// Interaction logic for Review.xaml
    /// </summary>
    public partial class Review : Window
    {
        private List<Question> questions;
        public Review(List<Question> questions)
        {
            this.questions = questions;
            InitializeComponent();
            LoadReviewQuestion();
        }

        private void LoadReviewQuestion()
        {
            foreach (Question q in questions)
            {
                int counter = 1;
                reviewBox.AppendText(q.MainQuestion + "\n");
                foreach (string s in q.Choices)
                {
                    reviewBox.AppendText(String.Format("\t{0})  {1}\n", counter++, s));
                }
                reviewBox.AppendText(String.Format("Correct Answer is:  {0}\n", q.Answer));
                reviewBox.AppendText(String.Format("       You Selected:  {0}\n", q.Selected_Answer));
                reviewBox.AppendText("\n");
            }
            reviewBox.ScrollToHome();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void button1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Escape)
                button1_Click(sender, e);
        }
    }
}
